Skip to content

fix: make Bash tool validation rule contextual for workflow commands#101

Merged
sjnims merged 1 commit intomainfrom
fix/validation-workflow-bash-rule
Dec 10, 2025
Merged

fix: make Bash tool validation rule contextual for workflow commands#101
sjnims merged 1 commit intomainfrom
fix/validation-workflow-bash-rule

Conversation

@sjnims
Copy link
Copy Markdown
Owner

@sjnims sjnims commented Dec 10, 2025

Summary

Updates the component validation workflow to use a contextual Bash tool rule instead of a blanket restriction, and corrects the Bash pattern syntax to match official documentation.

Problem

The validation rule at line 99 was:

- MUST use `Bash(gh:*)` not unrestricted `Bash` (security requirement)

This caused PR #100 to fail validation because create-plugin.md uses unrestricted Bash - but it legitimately needs broader access for:

  • mkdir -p - creating plugin directory structures
  • git init - initializing git repositories
  • Other filesystem operations

Additionally, the syntax Bash(gh:*) doesn't match official documentation, which specifies prefix matching with :* (e.g., Bash(gh pr:*)).

Solution

Updated the validation rule to be contextual:

  1. For simple commands: Recommend Bash prefix patterns like Bash(gh pr:*), Bash(npm run:*)
  2. For workflow/scaffolding commands: Allow unrestricted Bash when the command's purpose justifies filesystem operations
  3. Fixed syntax: Use correct :* wildcard notation per official docs

Alternatives Considered

Option Why Not Chosen
Keep blanket restriction Breaks legitimate workflow commands
Allowlist specific commands Doesn't scale, maintenance burden
Remove rule entirely Loses security guidance for simple commands

Changes

  • .github/workflows/component-validation.yml: Updated Bash validation rule (lines 99-100)

Testing

  • actionlint passes
  • Syntax matches official Claude Code documentation

Related


🤖 Generated with Claude Code

The previous rule "MUST use Bash(gh:*) not unrestricted Bash" was too
restrictive for workflow/scaffolding commands like create-plugin and
create-marketplace that legitimately need filesystem operations (mkdir,
git init, directory creation).

Changes:
- Use correct official Bash pattern syntax (prefix matching with :*)
- Allow unrestricted Bash when command purpose justifies it
- Provide examples of proper Bash prefix patterns

This enables PR #100 to pass validation while maintaining security
guidance for simpler commands.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@claude
Copy link
Copy Markdown

claude Bot commented Dec 10, 2025

Claude finished @sjnims's task in 1m 14s —— View job


PR Review: Contextual Bash Tool Validation Rule

  • Get PR diff to understand changes
  • Read the changed workflow file
  • Review validation rule changes
  • Verify alignment with Claude Code documentation
  • Post comprehensive review

Summary

✅ Looks good - This is a well-reasoned improvement to the validation workflow that makes the Bash tool restriction contextual and corrects the syntax.


What's Good

  1. Problem correctly identified: The blanket restriction MUST use Bash(gh:*) was indeed too restrictive for workflow/scaffolding commands like create-plugin.md that legitimately need filesystem operations (mkdir -p, git init, directory creation).

  2. Correct syntax fix: Changed from Bash(gh:*) to Bash(gh pr:*) with the :* wildcard notation, which matches the official Claude Code pattern for prefix matching.

  3. Contextual approach: The new rule distinguishes between:

    • Simple commands → prefer Bash prefix patterns like Bash(gh pr:*), Bash(npm run:*)
    • Workflow/scaffolding commands → allow unrestricted Bash when justified
  4. Well-documented PR: Excellent problem statement, solution explanation, alternatives considered table, and clear testing checklist.

  5. Minimal change: Only modified what's necessary (lines 99-100), keeping the fix focused.

  6. Clear validation criteria: The new rule includes guidance to "verify the command's stated purpose justifies broader access" - this gives Claude clear direction on when unrestricted Bash is acceptable.


Verification

I examined create-plugin.md (lines 120-148) and confirmed it:

  • Uses unrestricted Bash in allowed-tools (line 4)
  • Legitimately needs filesystem operations for:
    • mkdir -p plugin-name/.claude-plugin (line 127)
    • mkdir -p plugin-name/skills (line 128)
    • Git repo initialization (line 147)
    • Creating directory structures (lines 127-132)

This PR correctly unblocks that command while maintaining security guidance for simpler commands.


Checklist Verification

Workflow syntax: The validation rule syntax is correct
Documentation: PR description thoroughly explains the change
Testing: Author confirmed actionlint passes
No markdown changes: No markdown files changed, so no markdownlint needed
Contextual logic: The new rule provides clear guidance on when to use each pattern
Security maintained: Still encourages prefix patterns for simple commands while allowing broader access when justified


Recommendation

Approve and merge. This PR:

@sjnims sjnims self-assigned this Dec 10, 2025
@claude claude Bot added bug Something isn't working github-actions Pull requests that update GitHub Actions code effort:small < 1 hour labels Dec 10, 2025
@sjnims sjnims merged commit af67349 into main Dec 10, 2025
6 checks passed
@sjnims sjnims deleted the fix/validation-workflow-bash-rule branch December 10, 2025 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working effort:small < 1 hour github-actions Pull requests that update GitHub Actions code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant